<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Administrator_home extends MY_Administrator {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/home
	 *	- or -  
	 * 		http://example.com/index.php/home/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
    function __construct()
    {
        parent::__construct();
		//Load Model
		$this->load->model('administrator_home_model');
    }
	
	/*Hilight*/
	public function hilight($module=NULL,$arg=NULL)
	{
		//POST
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_home_model->hilight_update();
			redirect($this->session->userdata('returnUrl'));
		endif;		

		/*Keep Url*/
		$this->session->set_userdata('returnUrl', base_url($this->input->server('REQUEST_URI')));

		$this->data['dataResult'] = json_decode($this->db->get_where('module_page',array('page' => 'home'),1)->row()->json);
						
		$this->data['content'] = 'administrator/home/hilight';
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);
	}
	
	/*Hilight*/
	public function intrend($module=NULL,$arg=NULL)
	{
		//POST
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_home_model->intrend_update();
			redirect($this->session->userdata('returnUrl'));
		endif;		

		/*Keep Url*/
		$this->session->set_userdata('returnUrl', base_url($this->input->server('REQUEST_URI')));
		
		//Load ColorBox
		$this->data['js'][] = "jquery.colorbox-min.js";	
		$this->data['css'][] = "colorbox.css";
		
		$this->data['dataResult'] = json_decode($this->db->get_where('module_page',array('page' => 'home_intrend'),1)->row()->json);
		
		$this->data['content'] = 'administrator/home/intrend';
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);
	}	
	
	/*Carrier*/
	public function career($module=NULL,$arg=NULL)
	{
		//POST
		if(isset($_POST) && !empty($_POST)):
			$this->administrator_home_model->career_update();
			redirect($this->session->userdata('returnUrl'));
		endif;		

		/*Keep Url*/
		$this->session->set_userdata('returnUrl', base_url($this->input->server('REQUEST_URI')));
		
		//Load Ckeditor
		$this->load->helper('ckeditor');			

		$this->data['dataResult'] = $this->db->get_where('module_page',array('page' => 'career'),1)->row();
						
		$this->data['content'] = 'administrator/home/career';
		$this->load->view("templates/".$this->folder_templates."templates", $this->data);
	}	
}